import request from '@/utils/request'

export default {
  methods: {
    getNextNode(params, url = this.getNextNodeUrl) {
      delete params.node
      params.datagroupId = this.datagroupId
      return request({
        url,
        method: 'get',
        params
      })
    },
    add(params, url = this.addUrl) {
      return request({
        url,
        method: 'post',
        headers: {
          "Content-Type": "application/x-www-form-urlencoded"
        },
        data: params
      })
    },
    update(params, url = this.updateUrl) {
      return request({
        url,
        method: 'post',
        headers: {
          "Content-Type": "application/x-www-form-urlencoded"
        },
        data: params
      })
    },
    getDatagroupDimensionTreeInfo(params, url = this.getDatagroupDimensionTreeInfoUrl) {
      return request({
        url,
        method: 'get',
        params
      })
    },
    getDatagroupInfo(params, url = this.getDatagroupInfoUrl) {
      return request({
        url,
        method: 'get',
        params
      })
    },
    getBusinessobjectData(url = this.businessobjectUrl) {
      return request({
        url,
        method: 'get'
      })
    },
    getCodeTypeListInfo(url = this.getCodeTypeListUrl) {
      return request({
        url,
        method: 'get'
      })
    },
    getDimensionBustypeData(params, url = this.findDimensionBustypeUrl) {
      return request({
        url,
        method: 'get',
        params
      })
    },
    getResultsymbolData(url = this.resultsymbolUrl) {
      return request({
        url,
        method: 'get'
      })
    },
    getGroupTreeNodeNames(params, url = this.getGroupNameByIdsUrl) {
      return request({
        url,
        method: 'get',
        params
      })
    },
    addTableConfig(params, url = this.addTableConfigUrl) {
      return request({
        url,
        method: 'post',
        headers: {
          "Content-Type": "application/x-www-form-urlencoded"
        },
        data: params
      })
    }
  }
}
